package LastTest;

import java.io.*;
import java.util.Stack;
public class studentTest {
        public static void main(String[] args)  throws IOException {
            File file =new File("C:/java", "student.txt");
            if(!file.exists()){
                file.createNewFile();
            }
            Reader reader=new FileReader(file);
            BufferedReader br=new BufferedReader(reader);
            String content= br.readLine();
            String[] ss=content.split("<",6);
            String[] one=ss[0].split(" ",6);
            String[] two=ss[1].split(" ",6);
            String[] three=ss[2].split(" ",6);
            String[] four=ss[3].split(" ",6);
            String[] five=ss[4].split(" ",6);
            String[] six=ss[5].split(" ",6);
            Student student1= new Student();
            student1.inputStudent(one[0],Integer.parseInt(one[1]),Float.parseFloat(one[2]),Float.parseFloat(one[3]),Float.parseFloat(one[4]));
            Student student2= new Student();
            student2.inputStudent(two[0],Integer.parseInt(two[1]),Float.parseFloat(two[2]),Float.parseFloat(two[3]),Float.parseFloat(two[4]));
            Student student3= new Student();
            student3.inputStudent(three[0],Integer.parseInt(three[1]),Float.parseFloat(three[2]),Float.parseFloat(three[3]),Float.parseFloat(three[4]));
            Student student4= new Student();
            student4.inputStudent(four[0],Integer.parseInt(four[1]),Float.parseFloat(four[2]),Float.parseFloat(four[3]),Float.parseFloat(four[4]));
            Student student5= new Student();
            student5.inputStudent(five[0],Integer.parseInt(five[1]),Float.parseFloat(five[2]),Float.parseFloat(five[3]),Float.parseFloat(five[4]));
            Student student6= new Student();
            student6.inputStudent(six[0],Integer.parseInt(six[1]),Float.parseFloat(six[2]),Float.parseFloat(six[3]),Float.parseFloat(six[4]));
            Stack stack=new Stack();
            stack.push(student1);
            stack.push(student2);
            stack.push(student3);
            stack.push(student4);
            stack.push(student5);
            stack.push(student6);
            Student[] student2023= new Student[0];
            for(int i=0;i<6;i++){
                student2023[i]= (Student) stack.pop();
            }
            Student allmax=new Student();
            Student javamin=new Student();
            allmax=student2023[0];
            for (int i=0;i<6;i++){
                if(allmax.allSum()<student2023[i].allSum()){
                    allmax=student2023[i];
                }
            }
            javamin=student2023[0];
            for (int i=0;i<6;i++){
                if(javamin.getJavascore()>student2023[i].getJavascore()){
                    javamin=student2023[i];
                }
            }
            System.out.println("总分最高信息"+allmax.printStudent());
            System.out.println("java分最低信息"+allmax.printStudent());
        }
}


